import { a } from "./cookie.6dbf4ab5.js";
import { a as s } from "./axios.176b0184.js";
import "./__commonjsHelpers__.86354e3f.js";
import "./async-vendor.47a54775.js";
function u({ code: t, VUE_APP_BASE_API: r, token: e }) {
  return s({
    url: r + "/dictionary/getvaluelistbydiscode",
    method: "get",
    headers: {
      Authorization: `Bearer ${e}`
    },
    params: { code: t }
  }).then((n) => n.data);
}
function l(t) {
  try {
    return JSON.parse(t);
  } catch (r) {
    return console.error(r), null;
  }
}
const g = function(t) {
  var r = t && t.code;
  if (!r)
    return null;
  var e = `dic.${r}`, n = a.get(e);
  return n && sessionStorage.getItem(e) ? Promise.resolve(l(sessionStorage.getItem(e))) : u(r).then((o) => o.data).then((o) => o ? o && o.length <= 0 ? Promise.resolve([]) : (o = o.map((i) => ({
    label: i.name,
    value: i.code + ""
  })), a.set(e, 1, { expires: 0.5 / 24 }), sessionStorage.setItem(e, JSON.stringify(o)), Promise.resolve(o)) : Promise.resolve([]));
};
function d(t = [], r) {
  var e = t.filter((n) => n.value == r);
  if (e && e[0])
    return e[0].label;
}
function p(t = [], r) {
  var e = t.filter((n) => n.value == r);
  if (e && e[0])
    return e[0];
}
export {
  g as ajaxDicList,
  p as getLabelOne,
  d as getLabelText
};
